﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using DXApplicationTangche.UC.客户CRM.Service;
using DXApplicationTangche.UC.下单MTO.Service;

namespace DXApplicationTangche.UC.订单一览新.客户充值
{
    public partial class Form会员类型维护 : DevExpress.XtraEditors.XtraForm
    {
        private String mobile{get;set;}
        public Form会员类型维护(String mobile)
        {
            InitializeComponent();
            this.mobile = mobile;
            this.textBox客户电话.Text = mobile;
            this.手机号查找信息并赋值(mobile);
        }

        private void 手机号查找信息并赋值(String mobile)
        {
            CustomerPDTO customerPDTO = CRM客户Service.getCustomerPByMobile(mobile);
            this.textBox客户姓名.Text = customerPDTO.customerName;
            this.textBox详细地址.Text =
                customerPDTO.addressProvince
                + customerPDTO.addressCity
                + customerPDTO.addressDistrict
                + customerPDTO.addressDetail;
        }
        
        private void simpleButton保存_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(this.comboBox会员类型.Text))
            {
                MessageBox.Show("请选择会员类型");
                return;
            }
            CRM客户Service.saveMembership(this.mobile, this.comboBox会员类型.Text.Trim());
            this.Close();
        }
    }
}